<template>
  <lay-card>
    <lay-table
            :max-height="maxHeight"
            :columns="columns"
            :dataSource="dataSource"
            :default-toolbar="defaultToolbar" 
            even 
          >
    </lay-table>
  </lay-card>

    
</template>

<script lang="ts">
import { ref, watch,reactive,onMounted,h } from 'vue'
import { layer } from '@layui/layer-vue'
import MyHttp from "../../library/MyHttp";  
import MyWin from "../../library/MyWin"; 
import MyPage from "../../library/MyPage"; 
import {MyExcel} from "../../library/MyExcel"; 
import {MySimpleExport,TableColumn} from "../../library/MySimpleExport"; 
import MyData from '../../library/MyData';

import {useUserStore} from "../../store/user";  
import MyAuth from "../../library/MyAuth";  
import MyClientData from '../../library/MyClientData';
  



export default {
  props:{
      data:Object 
  },
   
 setup(prop:any, context:any) {
  
  const columns = ref<any>([
      
      {
        title: '序号',
        width: '50px' ,
        key: 'rowNo'
      },
    ]);
  onMounted(() =>{  
    
  });
   
  const setData=(rows:any)=>{
    if(rows.length>0){
      setColumns(rows[0]);
    }
    dataSource.value=rows;
  }
  const setColumns=(row:any)=>{
    var col=new Array();
    
    for(let key in row){
        col.push({
        title: key,
        width: '50px' ,
        key: key
      })
    };
    columns.value=col; 
  }
  const defaultToolbar = ref(false)
  const dataSource = ref([]);
  const maxHeight=ref<any>("350px");
  return {
    columns,
    defaultToolbar,
    dataSource,
    setData,
    maxHeight
    } 
  }
}
</script>
